﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace tPlat
{
    public class Database
    {
        public string InitialCatalog;
        private SqlConnection connection;
        private string username;
        private string password;
       
        public Database(string catalog)
        {
            // localhost
            SqlConnectionStringBuilder connBuilder = new SqlConnectionStringBuilder();
            connBuilder.Add("Data Source", @".\SQLEXPRESS");
            connBuilder.Add("Initial catalog", catalog);
            connBuilder.Add("Integrated Security", "SSPI");
            SqlConnection conn = new SqlConnection(connBuilder.ConnectionString);
            connection = conn;
        }

        public SqlConnection getConnection()
        {
            return this.connection;
        }

        public int Execute(string command)
        {
            SqlCommand c = new SqlCommand(command, connection);
            return c.ExecuteNonQuery();
        }
    }
}
